﻿/*****************************************************************************  

 Version: 0.1
 Website: http://www.visuagile.com/
 
 Copyright (c) Yoganand R. All rights reserved.
 For continued development and updates, visit http://yogsbreath.net
 
 ******************************************************************************/
#region Imports

using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;

using VisualAgile.IBLL;
using VisualAgile.IDAL;
using VisualAgile.Model;

#endregion


namespace VisualAgile.BLL
{
    public class ReleaseManager : BaseManager<Release>, IReleaseManager
    {
        #region Properties

        public IReleaseDao ReleaseDao { get; set; }

        #endregion

        protected override IBaseDao<Release> getBaseDAO()
        {
            return ReleaseDao;
        }

        /// <summary>
        /// Create a release (the default value contains the return)
        /// </summary>
        /// <returns></returns>
        public Release NewRelease()
        {
            var release = new Release();

            //System configuration can be used
            release.CreateTime = DateTime.Now;
            release.Name = "New Release"; // hard coded default release text
            release.PeriodFrom = DateTime.Now;
            release.PeriodTo = DateTime.Now.AddDays(27);
            
            return release;
        }

        /// <summary>
        /// Access to Releases
        /// </summary>
        /// <param name="ProjectName">project Id</param>
        /// <returns></returns>
        public IList GetByProject(Guid ProjectID)
        {
            return ReleaseDao.FindByProject(ProjectID);
        }
    }
}
